# -*- mode: python ; coding: utf-8 -*-

import os
import sys

# 获取当前脚本所在目录
base_dir = os.path.dirname(os.path.abspath(sys.argv[0]))

a = Analysis(
    ['dm_zhushou.py'],  # 主程序文件
    pathex=[base_dir],  # 添加项目根目录到搜索路径
    binaries=[
        (os.path.join(base_dir, 'config', 'DmReg.dll'), '.'),
        (os.path.join(base_dir, 'config', 'RegDll.dll'), '.'),
        (os.path.join(base_dir, 'config', 'dm.dll'), '.'),
    ],
    datas=[
        ('config', 'config'),
        ('common', 'common'),
        ('data', 'data'),
        ('tasks', 'tasks'),
    ],
    hiddenimports=[],  # 如果有缺失的库，添加在这里
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
    optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='dm_zhushou',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,  # 使用 UPX 压缩
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,  # 不显示控制台窗口
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
